<?php
declare (strict_types=1);

namespace app\admin\model\advertiser;

use app\BaseModel;

/**
 * 广告主用户表
 */
class AdvertiserUser extends BaseModel
{
    /**
     * 获取广告主用户列表
     * @param array $where
     * @param int $page
     * @param int $limit
     * @param string $orderby
     * @return array
     */
    public static function getList(array $where, int $page, int $limit, string $orderby = ''): array
    {
        $data = self::where($where)
            ->order($orderby)
            ->paginate(['list_rows' => $limit, 'page' => $page], false)
            ->toArray();
        //遍历数组
        foreach ($data['data'] as &$v) {
            unset($v['safe_code']);
            unset($v['password']);
        }
        return $data;
    }

    /**
     * 获取广告主全部用户列表
     * @param array $where
     * @param string $field
     * @param string $orderby
     * @return array
     */
    public static function getListAll(array $where, string $field, string $orderby = ''): array
    {
        $data = self::field($field)
            ->where($where)
            ->order($orderby)
            ->select()
            ->toArray();
        return $data;
    }


}




